<script setup>
    import FormList from '@/components/FormList.vue'

    let dialogVisible = $ref(false)
    let form = $ref({})

    let showType = $ref('')

    const showAddDialog = (data = {}, type) => {
        form = data
        showType = type
        dialogVisible = true
    }

    const formItem = [
        {
            label: '姓名',
            value: 's1',
        },
        {
            label: '人员类型',
            value: 's2',
        },
        {
            label: '身份证号码',
            value: 's3',
        },
        {
            label: '单位名称',
            value: 's4',
        },
        {
            label: '公益性岗位名称',
            value: 's5',
        },
        {
            label: '巡查人',
            value: 's6',
        },{
            label: '巡查时间',
            value: 's7',
        }
    ]

    defineExpose({
        showAddDialog
    })

</script>

<template>
    <el-dialog
        v-model="dialogVisible"
        :title="showType == 'add' ? '新增' : showType =='edit' ? '修改' : '详情'"
        custom-class="zz-dialog"
        width="900px"
        v-if="dialogVisible"
    >	
        <form-list :list="formItem" :formData="form" :type="showType"></form-list>

        <template #footer v-if="showType != 'details'">
            <span class="dialog-footer">
                <el-button @click="dialogVisible = false">取消</el-button>
                <el-button type="primary" @click="dialogVisible = false">
                    确定
                </el-button>
        </span>
        </template>
    </el-dialog>
</template>
